<style lang="less">
@import "./login.less";
</style>

<template>
  <div class="login">
    <div class="login-con">
      <Card icon="log-in" style="border-radius: 10px;" :bordered="false">
        <div style="text-align:center;">
          <img style="width:95px;height:95px;" src="../../assets/images/logo.jpg">
        </div>
        <div class="form-con">
          <login-form @on-success-valid="handleSubmit"></login-form>
        </div>
      </Card>
    </div>
  </div>
</template>

<script>
import LoginForm from "_c/login-form";
import { mapActions } from "vuex";
import {setTagNavListInLocalstorage} from '../../libs/util'

export default {
  components: {
    LoginForm
  },
  methods: {
    ...mapActions('user',["handleLogin"]),
    handleSubmit({ userName, password }) {
      this.handleLogin({ userName, password }).then(res => {
        setTagNavListInLocalstorage([]);//登录后清除点击导航生成的tab
        // this.getUserInfo().then(res => {
        this.$router.push({
          name: this.$config.homeName
        });
        // })
      });
    }
  }
};
</script>
